import component from "element-plus/es/components/tree-select/src/tree-select-option.mjs";
import {createMemoryHistory, createRouter, createWebHashHistory} from "vue-router";

// 配置路由规则
const routes = [
    {
        path: "/",
        redirect: "/login",
    },
    {
        path: "/login",
        component: () => import("../view/auth/Login.vue"),
    },
    {
        path: "/register",
        component: () => import("../view/auth/Register.vue"),
    },

    {
        path: "/homeAdmin",
        component: () => import("../view/home/HomeAdmin.vue"),
        redirect: "/admin/roomManagement",
        children: [
            {
                path: "/admin/userManagement",
                component: () => import("../view/admin/UserManagement.vue"),
            },
            {
                path: "/admin/employeeManagement",
                component: () => import("../view/admin/EmployeeManagement.vue")
            },
            {
                path: "/admin/roomManagement",
                component: () => import("../view/admin/RoomManagement.vue"),
            }
        ],
    },
    {
        path: "/homeStaff",
        component: () => import("../view/home/HomeStaff.vue"),
        redirect: "/staff/roomManagement",
        children: [
            {
                path: "/staff/roomManagement",
                component: () => import("../view/staff/RoomStatus.vue"),
            },
            {
                path: "/staff/cancelRequests",
                component: () => import("../view/staff/CancelRequests.vue"),
            },
        ],
    },
    {
        path: "/homeCustomer",
        component: () => import("../view/home/HomeCustomer.vue"),
        redirect: "/customer/roomList",
        children: [
            {
                path: "/customer/createOrder",
                component: () => import("../view/customer/createOrder.vue"),
            },
            {
                path: "/customer/orderList",
                component: () => import("../view/customer/orderList.vue"),
            },
            {
                path: "/customer/roomList",
                component: () => import("../view/customer/RoomList.vue"),
            },
        ],
    },
];

const router = createRouter({
    routes: routes,
    history: createWebHashHistory(),
});

export default router;
